package com.hnevc.xiaohui;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
     Button mBtnStrat,mBtnNo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        intiDate();
        initEven();
    }

    private void initEven() {
        
     }

    private void intiDate() {
        mBtnStrat.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(MainActivity.this,MyServier.class);
                //通过意图启动Service
                startService(intent);
            }
        });
        mBtnNo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               Intent intent =new Intent(MainActivity.this,MyServier.class);


            }
        });
    }

    private void initView() {
      mBtnStrat =findViewById(R.id.turnOn_btn);
      mBtnNo=findViewById(R.id.turnOff_btn);
    }

}